﻿using System;
using System.Data;
using System.Linq;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void YGRCPGB20(DataSet db)
        {
            try
            {/*GABBUCHDAT	GABART	GABFARBE	GPSPPART	GPFBPART	PRODNM	PRODQTY	INNM	INQTY	MOISTURE	PRODKG	INKG*/
                DataTable dtSoruce = db.Tables["GABEW"];
                DataTable dtOutput = new DataTable();
                dtOutput.Columns.Add("GPSPPART", typeof(System.String));
                dtOutput.Columns.Add("GABBUCHDAT", typeof(System.String));
                dtOutput.Columns.Add("GPFBPART", typeof(System.String));
                dtOutput.Columns.Add("GABART", typeof(System.String));
                dtOutput.Columns.Add("GABFARBE", typeof(System.String));
                dtOutput.Columns.Add("PRODNM", typeof(System.String));
                dtOutput.Columns.Add("PRODQTY", typeof(System.String));
                dtOutput.Columns.Add("APRODQTY", typeof(System.String));
                dtOutput.Columns.Add("RINQTY", typeof(System.String));
                dtOutput.Columns.Add("INNM", typeof(System.String));
                dtOutput.Columns.Add("INQTY", typeof(System.String));
                dtOutput.Columns.Add("SMOISTURE", typeof(System.String));
                dtOutput.Columns.Add("RMOISTURE", typeof(System.String));
                dtOutput.Columns.Add("MOISTURE", typeof(System.String));
                dtOutput.Columns.Add("PRODKG", typeof(System.String));
                dtOutput.Columns.Add("INKG", typeof(System.String));
                dtOutput.Columns.Add("DIFF", typeof(System.String));
                dtOutput.Merge(dtSoruce, false, MissingSchemaAction.Ignore);
                foreach (DataRow row in dtOutput.Rows)
                {
                    row["GPFBPART"] = GetGB2312Value(row["GPFBPART"].ToString());
                    row["GABFARBE"] = GetGB2312Value(row["GABFARBE"].ToString());
                }
                exAgent.DataTableToExcel(dtOutput, 2, 1);

                int count = dtOutput.Rows.Count;
                exAgent.SetCellValue(1, 1, 1);
                exAgent.BatchConvert2Number(2, 6, count + 1, 17);
                exAgent.SetCellValue(1, 1, "批号");

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        
    }
}